package com.yvan.dsf.tracing.api;

import java.io.Serializable;

public class Annotation implements Serializable {
    public static final String CLIENT_SEND = "cs";
    public static final String CLIENT_RECEIVE = "cr";
    public static final String SERVER_SEND = "ss";
    public static final String SERVER_RECEIVE = "sr";

    private Long timestamp;
    private String value;
    private Integer duration;
    private Endpoint endpoint;

    public Annotation() {

    }

    public Annotation(Long timestamp, String value, Endpoint host) {
        this.setTimestamp(timestamp);
        this.value = value;
        this.endpoint = host;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp * 1000L;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Endpoint getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(Endpoint endpoint) {
        this.endpoint = endpoint;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    @Override
    public String toString() {
        return "Annotation{" +
                "timestamp=" + timestamp +
                ", value='" + value + '\'' +
                ", duration=" + duration +
                ", endpoint=" + endpoint +
                '}';
    }
}
